{% from "../../macros/attributes.njk" import govukAttributes -%}
{% from "../../macros/logo.njk" import govukLogo -%}

{%- set _rebrand = params.rebrand | default(govukRebrand() if govukRebrand is callable else govukRebrand) -%}

<header class="govuk-header {%- if params.classes %} {{ params.classes }}{% endif %}" {{- govukAttributes(params.attributes) }}>
  <div class="govuk-header__container {{ params.containerClasses | default("govuk-width-container", true) }}">
    <div class="govuk-header__logo">
      <a href="{{ params.homepageUrl | default("//gov.uk", true) }}" class="govuk-header__homepage-link">
        {{ govukLogo({
          classes: "govuk-header__logotype",
          ariaLabelText: "GOV.UK",
          rebrand: _rebrand
        }) | trim | indent(8) }}
        {% if (params.productName) %}
        <span class="govuk-header__product-name">
          {{- params.productName -}}
        </span>
        {% endif %}
      </a>
    </div>
  </div>
</header>
